var t = require;
var e = module;
var o = exports;
var Adv_skd=require("./Adv_skd");
var n =
        (this && this.__extends) ||
        (function () {
            var t = function (e, o) {
                return (t =
                    Object.setPrototypeOf ||
                    ({__proto__: []} instanceof Array &&
                        function (t, e) {
                            t.__proto__ = e;
                        }) ||
                    function (t, e) {
                        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                    })(e, o);
            };
            return function (e, o) {
                function n() {
                    this.constructor = e;
                }
                t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
            };
        })(),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var r,
                a = arguments.length,
                i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
            return a > 3 && i && Object.defineProperty(e, o, i), i;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var a = t("BootConst"),
    i = t("GameData"),
    s = t("Util"),
    c = t("View"),
    l = t("Platforms"),
    u = t("Sounds"),
    p = t("WatchVideo"),
    f = t("ConfS"),
    d = t("fightManager"),
    h = t("fightView"),
    y = t("fun"),
    g = t("mainView"),
    v = t("money"),
    m = cc._decorator,
    _ = m.ccclass,
    A =
        (m.property,
        (function (t) {
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                return (e.res = "fail"), (e.isMask = !0), (e.zIndex = 1), e;
            }
            return (
                n(e, t),
                (e.prototype.onEnable = function () {
                    Adv_skd.default.instance.showInterstitialAd();
                    (this.find("复活").active = d.default.inst.能否复活),
                        cc.Canvas.instance.node.emit("战斗结束", !1),
                        u.Sounds.playFX("失败音效");
                    var t = this.find("money");
                    if (((t.active = d.default.ispvp), d.default.ispvp)) {
                        var e = this.showView(h.default).myrank.value + 1,
                            o = d.default.adata.type,
                            n = d.default.adata.count;
                        1 == e ? (n *= 1) : (n = 2 == e ? Math.round(0.5 * n) : Math.round(0.2 * n)),
                            t.getComponent(v.default).set(o, n);
                    }
                    if (d.default.ispvp) {
                        if (null == (r = f.DatasManager.HeroDatasById[i.default.hero])) return;
                        l.default.platformCtrl.dd(a.dd.PVPFail, {
                            eventTime: Date.now(),
                            currentHeroID: i.default.hero,
                            currentLV: y.getHeroLv(i.default.hero),
                            EnemyLv: d.default.adata.herolvs[d.default.adata.data.ID],
                            StageUseTime: Date.now() - d.default.进入时间,
                            remainMonster: d.default.inst.enemy.enemycount.value,
                            currentEquip1: i.default.equips.includes(r.equipids[0]),
                            currentEquip2: i.default.equips.includes(r.equipids[1]),
                            currentEquip3: i.default.equips.includes(r.equipids[2]),
                            currentSkill1LV: y.getSkillLv(r.skills[0]),
                            currentSkill2LV: y.getSkillLv(r.skills[1]),
                            currentSkill3LV: y.getSkillLv(r.skills[2])
                        });
                    } else {
                        var r;
                        if (null == (r = f.DatasManager.HeroDatasById[i.default.hero])) return;
                        l.default.platformCtrl.dd(a.dd.StageFail, {
                            eventTime: Date.now(),
                            StageID: d.default.fubendata.ID,
                            currentHeroID: i.default.hero,
                            currentLV: y.getHeroLv(i.default.hero),
                            StageUseTime: Date.now() - d.default.进入时间,
                            remainMonster: d.default.inst.enemy.enemycount.value,
                            currentEquip1: i.default.equips.includes(r.equipids[0]),
                            currentEquip2: i.default.equips.includes(r.equipids[1]),
                            currentEquip3: i.default.equips.includes(r.equipids[2]),
                            currentSkill1LV: y.getSkillLv(r.skills[0]),
                            currentSkill2LV: y.getSkillLv(r.skills[1]),
                            currentSkill3LV: y.getSkillLv(r.skills[2])
                        });
                    }
                }),
                (e.prototype.onClick = function (t) {
                    var e = this;
                    switch (t) {
                        case "退出":
                            if (d.default.ispvp) {
                                var o = this.showView(h.default).myrank.value + 1,
                                    n = d.default.adata.type,
                                    r = d.default.adata.count;
                                1 == o ? (r *= 1) : (r = 2 == o ? Math.round(0.5 * r) : Math.round(0.2 * r)),
                                    s.reward(n, r, "PVP失败");
                            }
                            this.hideView(), this.hideView(h.default), this.showView(g.default);
                            break;
                        case "复活":
                            p.default.show(a.dd.fail, function () {
                                e.hideView(), d.default.inst.复活();
                            });
                    }
                }),
                (e = r([_], e))
            );
        })(c.default));
o.default = A;
